package _15_generics._15_9.exercise;

/**
 * Create two interfaces and a class that implements
 * both. Create two generic methods, one whose argument
 * parameter is bounded by the first interface and
 * one whose argument parameter is bounded by the
 * second interface. Create an instance of the class
 * that implements both interfaces, and show that it
 * can be used with both generic methods
 */
public class E25_Bounds {
    static <T extends Top> void top(Top top){
        top.a();
    }
    static <T extends Low> void low(Low low){
        low.b();
    }

    public static void main(String[] args) {
        TopLowImpl topLow = new TopLowImpl();
        topLow.a();
        topLow.b();
    }
}

interface Top {
    void a();
}

interface Low {
    void b();
}

class TopLowImpl implements Top,Low {
    @Override
    public void a() {
        System.out.println("Top:a()");
    }

    @Override
    public void b() {
        System.out.println("Low:b()");
    }
}
